<!--
  @author nowind
  @since 17/07/23 14:34
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<title>修改跟单内容</title>
</head>
<body>
<div class="layui-fluid">
    <blockquote class="layui-crumb">
        <zmn th:text="订单配置 ">订单配置</zmn>&nbsp;&nbsp;/&nbsp;
        <a lay-href="/orderconfig/documentarycontent/list.action">跟单内容</a>&nbsp;&nbsp;/&nbsp;
        <zmn>[[${documentaryContentVO.content}]]</zmn>
    </blockquote>

    <div class="layui-card">

        <div class="layui-card-body">

            <form method="post" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="id" th:value="${documentaryContentVO.id}"/>

                <div class="layui-form-item" th:if="${documentaryContentVO.id > 0}">
                    <label class="layui-form-label">ID：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid">
                            <span th:text="${documentaryContentVO.id}">ID</span>
                            <span style="font-family:'ArialMT', 'Arial';color:#33AB9F;" th:text="${documentaryContentVO.status == 2 ? '正常' : '停用'}">status</span>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">跟单内容：</label>
                    <div class="layui-input-inline" style="width: 500px">
                        <input type="text" style="width:500px;" name="content" th:value="${documentaryContentVO.content}" placeholder="100字内"
                               lay-verify="required|content" autocomplete="off" class="layui-input" maxlength="100"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">解释说明：</label>
                    <div class="layui-input-inline" style="width: 500px">
                    <textarea placeholder="500字内" maxlength="500" th:text="${documentaryContentVO.statement}" id="statement" name="statement"
                              class="layui-textarea"></textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">责任部门：</label>
                    <div class="layui-input-inline">
                        <select name="responsibleDepartmentId" id="responsibleDepartmentId" lay-search="" lay-verify="required" th:value="${documentaryContentVO.responsibleDepartmentId}">
                            <option value="">请选择</option>
                            <zmn th:each="department:${departments}">
                                <option th:value="${department.deptId}" th:selected="${department.deptId == documentaryContentVO.responsibleDepartmentId}"
                                        th:text="${department.deptName}">责任部门
                                </option>
                            </zmn>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">跟单部门：</label>
                    <zmn th:if="${documentaryContentVO.departmentRelationsVOS != null && documentaryContentVO.departmentRelationsVOS.size() > 0}">
                        <div id="documentaryDepartmentDiv">
                            <zmn th:each="departmentRelationsVO, iterStat:${documentaryContentVO.departmentRelationsVOS}">
                                <div class="layui-input-block" th:id="${'documentaryDepartment'+iterStat.index}">
                                    <div class="layui-input-inline">
                                        <select class="documentaryDepartmentClass" lay-filter="documentaryDepartment" th:name="${'documentaryDepartmentId'+iterStat.index}" th:id="${'documentaryDepartmentId'+iterStat.index}" lay-search="" th:value="${departmentRelationsVO.documentaryDepartmentId}">
                                            <option value="">请选择</option>
                                            <zmn th:each="department:${departments}">
                                                <option th:value="${department.deptId}" th:selected="${department.deptId == departmentRelationsVO.documentaryDepartmentId}"
                                                        th:text="${department.deptName}">跟单部门
                                                </option>
                                            </zmn>
                                        </select>
                                    </div>

                                    <zmn th:if="${iterStat.index == 0}">
                                        <i th:onclick="deleteCompoent('documentaryDepartment'+[[${iterStat.index}]])" style="width: auto;visibility:hidden"  class="layui-input-inline layui-icon layui-icon-delete btn-del funcClass"></i>
                                    </zmn>

                                    <zmn th:if="${iterStat.index != 0}">
                                        <i th:onclick="deleteCompoent('documentaryDepartment'+[[${iterStat.index}]])" style="width: auto"  class="layui-input-inline layui-icon layui-icon-delete btn-del funcClass"></i>
                                    </zmn>

                                    <div class="layui-input-inline" style="width: 410px">
                                        <label class="layui-form-label">优先级：</label>
                                        <div class="layui-input-block">
                                            <input type="radio" class="departmentPriority" th:name="${'departmentPriority'+iterStat.index}" value="1" title="一级" th:checked="${departmentRelationsVO.priority==null || departmentRelationsVO.priority==1}">
                                            <input type="radio" class="departmentPriority" th:name="${'departmentPriority'+iterStat.index}" value="2" title="二级" th:checked="${departmentRelationsVO.priority==2}">
                                            <input type="radio" class="departmentPriority" th:name="${'departmentPriority'+iterStat.index}" value="3" title="三级" th:checked="${departmentRelationsVO.priority==3}">
                                        </div>
                                    </div>

                                    <zmn th:if="${iterStat.index == 0}">
                                        <div class="layui-input-inline" style="width: 245px">
                                            <label class="layui-form-mid" style="color: #9F9F9F;">跟单部门和工程师跟单至少勾选1项</label>
                                        </div>
                                    </zmn>

                                </div>

                                <div th:id="${'split'+iterStat.index}" class="layui-split">&nbsp;</div>
                            </zmn>
                        </div>

                        <div class="layui-input-block">
                            <a href="javascript:void(0)" id="addDocumentaryDepartment" style="text-decoration:underline;color: #00a0e9">+添加</a>
                        </div>
                    </zmn>

                    <zmn th:if="${documentaryContentVO.departmentRelationsVOS == null || documentaryContentVO.departmentRelationsVOS.size() == 0}">
                        <div id="documentaryDepartmentDiv">
                            <div class="layui-input-block" id="documentaryDepartment0">
                                <div class="layui-input-inline">
                                    <select class="documentaryDepartmentClass" lay-filter="documentaryDepartment" name="documentaryDepartmentId0" id="documentaryDepartmentId0" lay-search="">
                                        <option value="">请选择</option>
                                        <zmn th:each="department:${departments}">
                                            <option th:value="${department.deptId}"
                                                    th:text="${department.deptName}">跟单部门
                                            </option>
                                        </zmn>
                                    </select>
                                </div>

                                <i style="width: auto;visibility:hidden" onclick="deleteCompoent('documentaryDepartment0')" class="layui-input-inline layui-icon layui-icon-delete btn-del funcClass"></i>

                                <div class="layui-input-inline" style="width: 410px">
                                    <label class="layui-form-label">优先级：</label>
                                    <div class="layui-input-block">
                                        <input type="radio" class="departmentPriority0" name="departmentPriority0" value="1" title="一级" checked="checked">
                                        <input type="radio" class="departmentPriority0" name="departmentPriority0" value="2" title="二级" >
                                        <input type="radio" class="departmentPriority0" name="departmentPriority0" value="3" title="三级">
                                    </div>
                                </div>

                                <div class="layui-input-inline" style="width: 245px">
                                    <label class="layui-form-mid" style="color: #9F9F9F;">跟单部门和工程师跟单至少勾选1项</label>
                                </div>
                            </div>

                            <div class="layui-split">&nbsp;</div>
                        </div>

                        <div class="layui-input-block">
                            <a href="javascript:void(0)" id="addDocumentaryDepartment" style="text-decoration:underline;color: #00a0e9">+添加</a>
                        </div>
                    </zmn>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">服务商跟单：</label>
                    <div class="layui-input-inline">
                        <input type="checkbox" id="serviceProviderDocumentarySwitch" name="serviceProviderDocumentarySwitch" lay-filter="serviceProviderDocumentarySwitch" title="服务商跟单" lay-skin="primary" th:checked="${documentaryContentVO.serviceProviderDocumentarySwitch==2}">
                    </div>

                    <div class="layui-input-inline" style="width: 410px">
                        <label class="layui-form-label">优先级：</label>
                        <input type="radio" class="priority" name="serviceProviderDocumentaryPriority" value="1" title="一级" th:checked="${documentaryContentVO.serviceProviderDocumentaryPriority == null || documentaryContentVO.serviceProviderDocumentaryPriority == 1}">
                        <input type="radio" class="priority" name="serviceProviderDocumentaryPriority" value="2" title="二级" th:checked="${documentaryContentVO.serviceProviderDocumentaryPriority == 2}">
                        <input type="radio" class="priority" name="serviceProviderDocumentaryPriority" value="3" title="三级" th:checked="${documentaryContentVO.serviceProviderDocumentaryPriority == 3}">
                    </div>

                    <div class="layui-input-inline" style="width: 258px">
                        <label class="layui-form-mid" style="color: #9F9F9F;">勾选，则意味子公司/服务商可发起对应跟单</label>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">工程师跟单：</label>
                    <div class="layui-input-inline">
                        <input type="checkbox" id="engineerDocumentarySwitch" name="engineerDocumentarySwitch" lay-filter="engineerDocumentarySwitch" title="工程师跟单" lay-skin="primary" th:checked="${documentaryContentVO.engineerDocumentarySwitch==2}">
                    </div>

                    <div class="layui-input-inline" style="width: 410px">
                        <label class="layui-form-label">优先级：</label>
                        <input type="radio" class="priority" name="engineerDocumentaryPriority" value="1" title="一级" th:checked="${documentaryContentVO.engineerDocumentaryPriority == null || documentaryContentVO.engineerDocumentaryPriority == 1}">
                        <input type="radio" class="priority" name="engineerDocumentaryPriority" value="2" title="二级" th:checked="${documentaryContentVO.engineerDocumentaryPriority == 2}">
                        <input type="radio" class="priority" name="engineerDocumentaryPriority" value="3" title="三级" th:checked="${documentaryContentVO.engineerDocumentaryPriority == 3}">
                    </div>

                    <div class="layui-input-inline" style="width: 258px">
                        <label class="layui-form-mid" style="color: #9F9F9F;">勾选，则意味工程师app可发起对应跟单</label>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">业务类型：</label>
                    <div class="layui-input-block">
                        <zmn th:each="item:${bizTypeList}">
                            <input type="checkbox" name="bizType" th:value="${item.key}" th:title="${item.value}"
                                   th:checked="${documentaryContentVO.bizType != null && documentaryContentVO.bizType.indexOf(item.key+'') != -1}">
                        </zmn>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">排序ID：</label>
                    <div class="layui-input-inline">
                        <input type="number" name="sort" autocomplete="off" value="1000" class="layui-input" th:value="${documentaryContentVO.sort}"
                               lay-verify="required|sort" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">状态：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="停用"
                               th:checked="${documentaryContentVO.status == 1 || documentaryContentVO.id == null }">
                        <input type="radio" name="status" value="2" title="启用" th:checked="${documentaryContentVO.status == 2}">
                    </div>
                </div>

                <style>
                    .layui-form-label {
                        width: 130px;
                    }
                </style>

                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit"
                                th:if="${#authPermit.checkPermit('/orderconfig/documentarycontent/detail.action')}">提交
                        </button>
                        <button type="reset" class="layui-btn layui-btn-primary"
                                onclick="layui.admin.events.closeThisTabs();">取消
                        </button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
</body>
</html>

<script type="text/javascript" th:inline="javascript">
    var json = {
        departments: [[${departments}]]
    };

    layui.config({
        base: "/static/lay/",
        version: 20191023
    }).extend({
        index: "lib/index",
        orderconfig_documentarycontent_edit: "orderconfig/documentarycontent/zmn.orderconfig.documentarycontent.edit",
    }).use(['index', 'orderconfig_documentarycontent_edit']);

</script>